import {QuestionRadioDefaultProps, QuestionRadioPropsType} from "./interface";
import {Radio, Space, Typography} from "antd";

const {Paragraph} = Typography
export const Component = (props: QuestionRadioPropsType) => {
    const {title, isVertical, options = [], value} = {...QuestionRadioDefaultProps, ...props};

    return (
        <div>
            <Paragraph strong>{title}</Paragraph>
            <Radio.Group value={value}>
                <Space direction={isVertical ? 'vertical' : 'horizontal'}>
                    {options.map(item => {
                        const {value, text} = item
                        return <Radio key={value} value={value}>{text}</Radio>
                    })}
                </Space>
            </Radio.Group>
        </div>
    );
};